package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.ApiT_enums;

//DAO
public interface T_enumsMapperBase {

	// 根据id查看
	@Select("SELECT * FROM t_enums  WHERE id = #{id}")
	public ApiT_enums findT_enumsById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM T_enums")
	public List<ApiT_enums> findT_enumss();

	// 添加
	@Insert("INSERT INTO t_enums (parent_id, sort, item_key, display_name, item_value, create_time) VALUES ( #{parent_id}, #{sort}, #{item_key}, #{display_name}, #{item_value}, #{create_time})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertT_enums(ApiT_enums t_enums);

	// 修改
	@Update("UPDATE t_enums SET parent_id = #{parent_id}, sort = #{sort}, item_key = #{item_key}, display_name = #{display_name}, item_value = #{item_value}, create_time = #{create_time} WHERE id = #{id}")
	public int updateT_enums(ApiT_enums t_enums);

	// 删除
	@Delete("DELETE FROM t_enums  WHERE id = #{id}")
	public int deleteT_enums(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

	// 获取根据parent_id
	@Select("SELECT id, parent_id, sort, item_key, display_name, item_value, create_time FROM t_enums  WHERE parent_id = #{parent_id}")
	public List<ApiT_enums> findT_enumssByParent_id(String parent_id);

	// 获取根据item_key
	@Select("SELECT id, parent_id, sort, item_key, display_name, item_value, create_time FROM t_enums  WHERE item_key = #{item_key}")
	public List<ApiT_enums> findT_enumssByItem_key(String item_key);

}
